fix(akamai): recover fetcher key on reconciled deploy status - #3193
fix(akamai): recover fetcher key on reconciled deploy status#3193adityamisra08 wants to merge 5 commits into
Conversation
deploy-status now returns the managed rule's fetcher key, gated on freshWrite !== false so a stale/inherited key from a prior onboarding is never surfaced. Lets the onboarding UI recover the key for Bot Manager allowlisting after a deploy response was lost to the CDN timeout, instead of forcing a re-deploy just to see it again.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Hey @adityamisra08,
⚠ Degraded review - no spec document was found for this change (searched the PR links, the touched repos' docs, the architecture/guidelines docs, and linked Jira). This review covers code-level quality but could not validate the change against an agreed design, so confidence is reduced. Add a spec link (PR template section 4) and re-request review for a full-confidence pass.
Verdict: Request changes - one blocking finding on the API contract for fetcherKey: null.
Complexity: MEDIUM - small diff; API surface.
Changes: Returns the Akamai Bot Manager fetcher key in deploy-status responses when the key belongs to the current deploy, enabling recovery after CDN timeouts (3 files).
Note: CI checks are currently pending.
Must fix before merge
- [Important]
fetcherKey: nullreturned when managed rule exists but fetcher-key header is absent -src/controllers/llmo/llmo-akamai.js:922(details inline)
Non-blocking (2): minor issues and suggestions
- nit:
getManagedFetcherKey(ruleTree)is called twice on the same immutable tree whenbaseVersionis supplied;targetKeyfrom the freshWrite comparison already holds the result -src/controllers/llmo/llmo-akamai.js:922 - suggestion: add
expect(body).to.not.have.property('fetcherKey')to the existingdeployed:falsetest to lock in the new contract -test/controllers/llmo/llmo-akamai.test.js:559
Skill: pr-review | Model: us.anthropic.claude-opus-4-6-v1[1m] | Duration: 0m 54s | Cost: $6.66 | Commit: 91cba0fe92d6bcccbc05cdf7de1fe8ede170d1fd
If this code review was useful, please react with 👍. Otherwise, react with 👎.
Guard the recovered key against null (rule present but the fetcher-key header itself is missing/malformed) so the response omits the field instead of sending fetcherKey: null, which would read as "recovered" to a consumer checking presence. Also hoists the tree read so it's done once instead of twice. Addresses review feedback on #3193.
|
This PR will trigger a patch release when merged. |
|
All 3 items from the review addressed in f56b267:
115/115 unit tests passing. |
There was a problem hiding this comment.
Hey @adityamisra08,
⚠ Degraded review - no spec document was found for this change (searched the PR links, the touched repos' docs, the architecture/guidelines docs, and linked Jira). This review covers code-level quality but could not validate the change against an agreed design, so confidence is reduced. Add a spec link (PR template section 4) and re-request review for a full-confidence pass.
Verdict: Approve - all prior findings addressed; no new blocking issues.
Complexity: MEDIUM - small diff; API surface.
Changes: Returns the Akamai Bot Manager fetcher key in deploy-status responses when the key belongs to the current deploy, enabling recovery after CDN timeouts (3 files).
Note: CI checks are currently pending.
Non-blocking (2): minor issues and suggestions
- suggestion: The no-baseVersion path returns the fetcher key without freshWrite confirmation. The trust model is sound (callers already own the property's EdgeGrid credentials), but the JSDoc claim that the key is "confirmed to belong to THIS deploy" is slightly imprecise for this case - consider a brief note in the comment acknowledging the trust assumption -
src/controllers/llmo/llmo-akamai.js:928 - suggestion: Verify that the response's
Cache-Controlheader (or Fastly'sSurrogate-Control) prevents caching of this route, since deploy-status now carries a secret value
Previously flagged, now resolved
fetcherKey: nullleak when managed rule exists but fetcher-key header is absent - now guarded byrecoveredKey && freshWrite !== false- Duplicate
getManagedFetcherKey(ruleTree)tree walk - hoisted intorecoveredKeyand reused for both the freshWrite compare and the response - Missing negative assertions on
deployed:falseanddeployed:true/no-header tests - added, plus positive assertions on the recovery paths
Skill: pr-review | Model: us.anthropic.claude-opus-4-6-v1[1m] | Duration: 2m 14s | Cost: $5.08 | Commit: f56b26754e3a10744f71fdc3cc5aa52157ee8820
If this code review was useful, please react with 👍. Otherwise, react with 👎.
Summary
deploy-statusnow returns the managed rule's fetcher key whendeployed && freshWrite !== false— i.e. only when the key found belongs to THIS deploy, never a stale key inherited from a prior onboarding.getManagedFetcherKeyanddeployStatusthat previously asserted the key is "never returned" — narrowed to the new, guarded contract.deployStatus/freshWriteunit tests whose old assertions ("key is never returned") directly contradicted this intended behavior change.Companion frontend PR: adobe/project-elmo-ui (same branch name
fix/akamai-recover-fetcher-key).Test plan
npx eslintclean on all 3 changed filesnpx mocha test/controllers/llmo/llmo-akamai.test.js— 115/115 passingnpm run docs:lint— no new issues (pre-existing warnings only)tsctype-check (via pre-commit hook) — passing